home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
PDReadInfo.z
/
PDReadInfo
Wrap
Text File
|
1998-10-30
|
31KB
|
595 lines
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
NNNNAAAAMMMMEEEE
PDReadInfo, PDLocalReadInfo, PDLocalWriteInfo - read/write the printer
configuration and status information
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ppppoooodddd....hhhh>>>>
iiiinnnntttt PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,, PPPPDDDDIIIInnnnffffooooSSSSttttrrrruuuucccctttt ********iiiinnnnffffoooopppp,,,,
ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
iiiinnnntttt PPPPDDDDLLLLooooccccaaaallllRRRReeeeaaaaddddIIIInnnnffffoooo((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
PPPPDDDDIIIInnnnffffooooSSSSttttrrrruuuucccctttt ********iiiinnnnffffoooopppp,,,, ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
iiiinnnntttt PPPPDDDDLLLLooooccccaaaallllWWWWrrrriiiitttteeeeIIIInnnnffffoooo((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
PPPPDDDDIIIInnnnffffooooSSSSttttrrrruuuucccctttt ****iiiinnnnffffoooo))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_P_D_R_e_a_d_I_n_f_o and _P_D_L_o_c_a_l_R_e_a_d_I_n_f_o fill a _P_D_I_n_f_o_S_t_r_u_c_t structure with the
current configuration and status information for the specified printer,
_p_r_i_n_t_e_r__n_a_m_e. _i_n_f_o_p is set to point to the newly filled structure.
_m_o_d__t_i_m_e_p is set to the time the printer information was last modified
(see _t_i_m_e(_2)). _P_D_R_e_a_d_I_n_f_o will read information from local and remote
printers.
_P_D_L_o_c_a_l_W_r_i_t_e_I_n_f_o writes the specified _P_D_I_n_f_o_S_t_r_u_c_t structure to the
specified printer's configuration and status files. _i_n_f_o should point to
a filled in _P_D_I_n_f_o_S_t_r_u_c_t structure. If the _a_c_t_i_v_e__s_t_a_t_u_s field of the
_P_D_I_n_f_o_S_t_r_u_c_t is NNNNUUUULLLLLLLL, only the configuration file information will be
modified. In this case the _e_r_r_o_r__s_t_a_t_u_s field will be ignored. This
function should only be used by administrative applications that need to
modify a local printer's configuration information (e.g. a printer
installation program). Printer drivers and application programs should
not modify the printer configuration information.
Refer to the _l_i_b_p_o_d(_3) man page for more information about the "Local"
functions.
The _P_D_I_n_f_o_S_t_r_u_c_t contains detailed information about a printer's
capabilities as well as its current operational status. The structure
does not contain log file information. The _P_D_I_n_f_o_S_t_r_u_c_t structure is
defined as follows.
typedef struct _pdInfoStruct {
char printer_class[PD_STR_MAX]; /* e.g. "PostScript", */
/* "Color Raster", */
/* "Plotter" */
char printer_model[PD_STR_MAX]; /* e.g. "Phaser II SX" */
char printer_options[PD_STR_MAX]; /* Option info */
/* (e.g. "8 MB RAM") */
char location_code[PD_STR_MAX]; /* Machine parsable, no */
/* blanks, e.g. "3U-924" */
char physical_location[PD_STR_MAX]; /* Human readable, e.g. */
PPPPaaaaggggeeee 1111
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
/* "Bldg. 3U, Room 924" */
char technology[PD_STR_MAX]; /* e.g. "Ink Jet", */
/* "Wax Transfer" */
char config_path[PD_STR_MAX]; /* Path to config file */
char driver_path[PD_STR_MAX}; /* Driver pathname */
char port_path[PD_STR_MAX]; /* Device port pathname */
char active_path[PD_STR_MAX]; /* Path to status file */
int error_retry_wait; /* Driver error retry */
/* interval, seconds */
int status_update_wait; /* Status polling */
/* interval, seconds */
int media_wait; /* Manual feed wait */
/* time, seconds */
int horizontal_resolution; /* Resolutions, dpi */
int vertical_resolution;
float cost_per_page; /* Cost in local */
/* currency e.g. 0.50 */
int avg_time_per_page; /* Times in seconds */
int max_time_per_page;
int min_number_of_colors; /* No. of colors available*/
int max_number_of_colors;
float min_area_horizontal; /* Printable areas, in. */
float min_area_vertical;
float max_area_horizontal;
float max_area_vertical;
int min_addr_horizontal; /* Printable areas, dots */
int min_addr_vertical;
int max_addr_horizontal;
int max_addr_vertical;
int quality_modes; /* No. of quality modes */
char **quality_mode_names; /* Mode names */
int default_quality_mode; /* Default mode index */
int manual_capable; /* Manual feed capable, */
/* 0 = no, 1 = yes */
int black_substitute; /* Substitute true black */
/* for composite black, */
/* 0 = no, 1 = yes */
int media_standard; /* Media measurement */
/* standard, e.g. Metric */
int avail_fonts; /* Number of fonts */
char **avail_fonts_names; /* Font names */
int input_sources; /* No. of input sources */
char **input_sources_names; /* Input source names */
int default_input_source; /* Default input index */
float input_source_gamma; /* Source gamma value */
int color_adjustment; /* Number of color */
/* adjustment schemes */
char **color_adj_names; /* Color adj scheme names */
int default_color_adj; /* Default adj scheme */
/* index */
int media_types; /* Number of media types */
char **media_types_names; /* Media type names */
PPPPaaaaggggeeee 2222
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
int default_media_type; /* Default media type */
int size_table_entries; /* Number of media size */
/* table entries */
PDSizeTableStruct *size_table; /* Media size table */
PDStatusStruct *active_status; /* Status information */
PDMessageStruct *error_status; /* Error, warning and */
/* info messages */
} PDInfoStruct;
_p_r_i_n_t_e_r__c_l_a_s_s Printer class string (e.g. "ColorPostScript",
"Plotter").
_p_r_i_n_t_e_r__m_o_d_e_l Printer model name (e.g. "LaserWriter II NTX").
_p_r_i_n_t_e_r__o_p_t_i_o_n_s Installed printer options (e.g. "8 MByte RAM",
"PostScript Cartridge").
_l_o_c_a_t_i_o_n__c_o_d_e Physical location of the printer in machine parsable
format (e.g. "3U-924").
_p_h_y_s_i_c_a_l__l_o_c_a_t_i_o_n Physical location of the printer in human readable
format (e.g. "Bldg. 3U, Room 924").
_t_e_c_h_n_o_l_o_g_y Printing technology (e.g. "Wax transfer", "Dye
sublimation").
_c_o_n_f_i_g__p_a_t_h Complete pathname of configuration file. This is set
to PPPPDDDDppppoooodddd____ppppaaaatttthhhh/[printer_name].config by _l_i_b_p_o_d.
_d_r_i_v_e_r__p_a_t_h Complete pathname of printer driver program (e.g.
"/usr/lib/print/phandler").
_p_o_r_t__p_a_t_h Complete pathname of printer port device driver (e.g.
"/dev/plp").
_a_c_t_i_v_e__p_a_t_h Complete pathname of status file. This is set by
_l_i_b_p_o_d to be PPPPDDDDppppoooodddd____ppppaaaatttthhhh/[printer_name].status.
_e_r_r_o_r__r_e_t_r_y__w_a_i_t Number of seconds to wait before attempting to resume
printing following an error.
_s_t_a_t_u_s__u_p_d_a_t_e__w_a_i_t Number of seconds between updates of the printer
status file.
_m_e_d_i_a__w_a_i_t Number of seconds to wait for manual or print media
changes.
_h_o_r_i_z_o_n_t_a_l__r_e_s_o_l_u_t_i_o_n, _v_e_r_t_i_c_a_l__r_e_s_o_l_u_t_i_o_n
Horizontal and vertical printer resolution in dots
per inch (dpi).
PPPPaaaaggggeeee 3333
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
_c_o_s_t__p_e_r__p_a_g_e Cost per page in local currency (e.g. "0.50" for 50
cents per page).
_a_v_g__t_i_m_e__p_e_r__p_a_g_e, _m_a_x__t_i_m_e__p_e_r__p_a_g_e
Average and maximum time to print a page in seconds.
_m_i_n__n_u_m_b_e_r__o_f__c_o_l_o_r_s, _m_a_x__n_u_m_b_e_r__o_f__c_o_l_o_r_s
Minimum and maximum number of colors available. A
monochrome printer or printer ribbon would provide
one available color. A CMY printer or ribbon would
provide three colors. A CMYK printer or ribbon would
provide four colors. Note that these fields should
only contain the number of colors as opposed to the
_n_u_m_b_e_r__o_f__c_o_l_o_r_s field in the _P_D_S_t_a_t_u_s_S_t_r_u_c_t which is
used as a bitmask to specify the current number of
colors as well as the colorspace, pixel depth and
data format.
_m_i_n__a_r_e_a__h_o_r_i_z_o_n_t_a_l, _m_i_n__a_r_e_a__v_e_r_t_i_c_a_l
Minimum printable horizontal and vertical dimensions
in inches.
_m_a_x__a_r_e_a__h_o_r_i_z_o_n_t_a_l, _m_a_x__a_r_e_a__v_e_r_t_i_c_a_l
Maximum printable horizontal and vertical dimensions
in inches.
_m_i_n__a_d_d_r__h_o_r_i_z_o_n_t_a_l, _m_i_n__a_d_d_r__v_e_r_t_i_c_a_l
Minimum printable horizontal and vertical dimensions
in dots.
_m_a_x__a_d_d_r__h_o_r_i_z_o_n_t_a_l, _m_a_x__a_d_d_r__v_e_r_t_i_c_a_l
Maximum printable horizontal and vertical dimensions
in dots.
_q_u_a_l_i_t_y__m_o_d_e_s Number of printer quality modes.
_q_u_a_l_i_t_y__m_o_d_e__n_a_m_e_s Names of quality modes (e.g. "draft", "letter").
_d_e_f_a_u_l_t__q_u_a_l_i_t_y__m_o_d_e
The default quality mode expressed as an index into
the list of quality mode names. Note that this value
is based at one rather than zero. To use this value
as an array index, subtract one from the value.
_m_a_n_u_a_l__c_a_p_a_b_l_e Boolean indicating whether the printer is (1) or is
not (0) capable of manual feed.
_b_l_a_c_k__s_u_b_s_t_i_t_u_t_e Boolean indicating whether true black should (1) or
should not (0) be substituted for composite black.
PPPPaaaaggggeeee 4444
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
_m_e_d_i_a__s_t_a_n_d_a_r_d Code indicating paper measurement standard in use
(see _p_o_d._h). The measurement standard is typically
American or Metric.
_a_v_a_i_l__f_o_n_t_s Number of available fonts.
_a_v_a_i_l__f_o_n_t_s__n_a_m_e_s Names of available fonts (e.g. "Courier",
"Helvetica").
_i_n_p_u_t__s_o_u_r_c_e_s Number of printer input sources.
_i_n_p_u_t__s_o_u_r_c_e_s__n_a_m_e_s Names of possible printer input sources (e.g. "Sony
16 inch Monitor").
_d_e_f_a_u_l_t__i_n_p_u_t__s_o_u_r_c_e
Default input source expressed as an index into the
list of input source names. The input source is
typically used for determining printer color
correction. Note that this value is based at one
rather than zero. To use this value as an array
index, subtract one from the value.
_i_n_p_u_t__s_o_u_r_c_e__g_a_m_m_a Gamma value of the input source. This value is
typically used in determining printer color
correction.
_c_o_l_o_r__a_d_j_u_s_t_m_e_n_t Number of printer color correction schemes.
_c_o_l_o_r__a_d_j__n_a_m_e_s Names of available color correction schemes (e.g.
"Improve Blue").
_d_e_f_a_u_l_t__c_o_l_o_r__a_d_j Default color correction scheme expressed as an index
into the list of color correction names. Note that
this value is based at one rather than zero. To use
this value as an array index, subtract one from the
value.
_m_e_d_i_a__t_y_p_e_s Number of possible media types.
_m_e_d_i_a__t_y_p_e_s__n_a_m_e_s Names of possible media types (e.g. "Paper",
"Transparency").
_d_e_f_a_u_l_t__m_e_d_i_a__t_y_p_e Default media type expressed as an index into the
list of media type names. Note that this value is
based at one rather than zero. To use this value as
an array index one must be subtracted.
_s_i_z_e__t_a_b_l_e__e_n_t_r_i_e_s Number of entries in the print media size table.
_s_i_z_e__t_a_b_l_e An array of printer media size table entries. Each
entry describes a single print medium in detail. See
below for detailed information on this structure.
PPPPaaaaggggeeee 5555
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
_a_c_t_i_v_e__s_t_a_t_u_s Pointer to the printer status information structure.
Refer to _P_D_R_e_a_d_S_t_a_t_u_s(_3) for detailed information on
this structure.
_e_r_r_o_r__s_t_a_t_u_s Pointer to the printer message list. This is an array
of printer error, warning and information messages.
The number of messages in the array is given by the
_e_r_r_o_r__c_o_u_n_t field of the _a_c_t_i_v_e__s_t_a_t_u_s structure.
The _P_D_S_i_z_e_T_a_b_l_e_S_t_r_u_c_t is defined as follows.
typedef struct _pdSizeTableStruct {
int media_size; /* Generic media name token */
int horizontal_addr; /* Horizontal dots */
int vertical_addr; /* Vertical dots */
float width; /* Width in inches */
float length; /* Length in inches */
float left_margin; /* Left margin in inches */
float top_margin; /* Top margin in inches */
char raster_definition; /* Raster direction and */
/* orientation bits */
char validation_mask; /* Entry validation */
char variable_page_size; /* Reserved */
} PDSizeTableStruct;
_m_e_d_i_a__s_i_z_e Media size code (see _p_o_d._h).
_h_o_r_i_z_o_n_t_a_l__a_d_d_r, _v_e_r_t_i_c_a_l__a_d_d_r
Number of horizontal and vertical dots. This is also
the length of each raster line and the number of
raster lines, respectively.
_w_i_d_t_h Width of the medium in inches along the raster line.
_l_e_n_g_t_h Length of the medium in inches perpendicular to the
raster line.
_l_e_f_t__m_a_r_g_i_n Non-printable distance in inches to the left of each
raster line.
_t_o_p__m_a_r_g_i_n Non-printable distance in inches before the first
raster line.
_r_a_s_t_e_r__d_e_f_i_n_i_t_i_o_n Code describing the direction and orientation of the
printer raster (see _p_o_d._h).
_v_a_l_i_d_a_t_i_o_n__m_a_s_k Size table entry validation mask. If _P_D_F_i_n_d_P_a_g_e_S_i_z_e
is called with a size code of PPPPDDDD____SSSSIIIIZZZZEEEE____CCCCUUUURRRRRRRREEEENNNNTTTT,
dimensional information for the currently loaded
paper size will be returned. The mechanics of
determining this information is as follows. The
PPPPaaaaggggeeee 6666
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
_m_e_d_i_a__s_i_z_e field of the _P_D_S_t_a_t_u_s_S_t_r_u_c_t is used as the
size code to search the page table in the
_P_D_I_n_f_o_S_t_r_u_c_t. Dimensional information is returned
for the page size entry that matches the _m_e_d_i_a__s_i_z_e
value and whose validation masks satisfy the
relationship (_s_t_a_t_u_s _m_a_s_k & _t_a_b_l_e _m_a_s_k) == _s_t_a_t_u_s
_m_a_s_k. The validation mask can be helpful in
specifying page dimensions for printers that support
multiple resolutions. The page table can contain a
number of page names that are identical but with
dimensions appropriate to different resolutions. Each
entry would have a unique validation mask. This way
the status validation mask could be used to select
the proper page size for the current output
resolution.
_v_a_r_i_a_b_l_e__p_a_g_e__s_i_z_e Reserved for future use. When writing the size table
always set this field to 0.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
0 is returned if execution was successful. -1 is returned and _P_D_e_r_r_n_o is
set if an execution error has occurred.
EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
_P_D_R_e_a_d_I_n_f_o and _P_D_L_o_c_a_l_R_e_a_d_I_n_f_o will fail under the following
circumstances.
PD_LIBERR_BAD_PNAME A NULL or empty printer name string has been
specified.
PD_LIBERR_STATUS_READ The status file could not be opened for reading
or an error occurred while reading the file.
PD_LIBERR_CONFIG_READ The config file could not be opened for reading
or an error occurred while reading the file.
In addition, _P_D_R_e_a_d_I_n_f_o will fail under the following circumstances.
PD_LIBERR_NO_PRINTER The specified printer has not been registered
with the printer spooling system and is,
therefore, inaccessible.
PD_LIBERR_BAD_HOSTNAME The network address of the specified hostname
could not be found.
PD_LIBERR_NETWORK For an unknown reason, a network connection
could not be made with the remote printer host.
PD_LIBERR_NET_TIMEOUT A timeout occurred while attempting to
communicate with the remote printer host.
PPPPaaaaggggeeee 7777
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
PD_LIBERR_NET_INTR The program has been interrupted while
attempting to communicate with the remote
printer host.
PD_LIBERR_NET_NOTREG The podd daemon is not registered on the remote
printer host.
PD_LIBERR_NET_PMAP The port mapper daemon failed on the remote
printer host.
PD_LIBERR_NET_NOPROC The client has called a libpod function that is
not supported by the podd daemon on the remote
printer host.
PD_LIBERR_NET_CLNTXDR The libpod library XDR routines and the kernel's
XDR routines are incompatible.
PD_LIBERR_NET_SVCXDR The podd daemon XDR routines and the remote
printer host's kernel XDR routines are
incompatible.
PD_LIBERR_NET_RPCMATCH The version of RPC software on the client is
incompatible with the version on the remote
printer host.
PD_LIBERR_NET_PROCMATCH The version of the specified libpod function on
the client is incompatible with the version on
the remote printer host.
_P_D_W_r_i_t_e_I_n_f_o will fail under the following circumstances.
PD_LIBERR_BAD_STRUCT A NULL structure pointer has been specified.
PD_LIBERR_BAD_PNAME A NULL or empty printer name string has been
specified.
PD_LIBERR_CONFIG_WRITE The config file could not be opened for writing
or an error occurred while writing the file.
PD_LIBERR_STATUS_WRITE The status file could not be opened for writing
or an error occurred while writing the file.
PD_LIBERR_MAX_MESSAGE A request has been made to write more than
PPPPDDDD____MMMMEEEESSSSSSSSAAAAGGGGEEEE____MMMMAAAAXXXX messages to the status file.
PD_LIBERR_BAD_MSGCNT An invalid value has been specified for the
number of messages to write to the status file.
PPPPaaaaggggeeee 8888
PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo PPPPDDDDRRRReeeeaaaaddddIIIInnnnffffoooo((((3333))))
WARNINGS
1. Upon successful execution, the function sets _i_n_f_o_p to point to an
internal copy of the _P_D_I_n_f_o_S_t_r_u_c_t. The contents of this structure
can change after each _l_i_b_p_o_d function call. To preserve the contents
of the structure across _l_i_b_p_o_d calls, it should be copied into
user-allocated storage.
2. The function _P_D_R_e_a_d_I_n_f_o calls the _l_i_b_s_p_o_o_l function
_S_L_G_e_t_P_r_i_n_t_e_r_I_n_f_o. This _l_i_b_s_p_o_o_l function is not reentrant. This
means that any pointer returned by a previous call to
_S_L_G_e_t_P_r_i_n_t_e_r_I_n_f_o will be invalid after a call to _P_D_R_e_a_d_I_n_f_o.
NNNNOOOOTTTTEEEESSSS
1. _P_D_R_e_a_d_I_n_f_o and _P_D_L_o_c_a_l_R_e_a_d_I_n_f_o obtain printer information from the
config and status POD files. _m_o_d__t_i_m_e_p is set to the modification
time of the file that has been most recently modified.
2. The _P_D_W_r_i_t_e_I_n_f_o function ignores the _c_o_n_f_i_g__p_a_t_h and _a_c_t_i_v_e__p_a_t_h
fields of the _P_D_I_n_f_o_S_t_r_u_c_t. The function automatically provides
pathname values for these fields.
FFFFIIIILLLLEEEESSSS
/var/spool/lp/pod/[printer name].config
/var/spool/lp/pod/[printer name].status
SSSSEEEEEEEE AAAALLLLSSSSOOOO
PDReadStatus(3), libpod(3), time(2), ctime(3), podd(1M)
PPPPaaaaggggeeee 9999